package com.example.data.jdbc.dao;

import com.example.data.jdbc.entity.User;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author fanhang
 */
public interface UserExtOperation {
    /**
     * 第 3 种自定义
     */
    List<User> findCustomerImpl(int age, String remark);

    @Repository
    record UserExtImpl(JdbcTemplate jdbcTemplate) implements UserExtOperation {
        @Override
        public List<User> findCustomerImpl(int age, String remark) {
            return jdbcTemplate.queryForList("select * from t_user where age = ? and remark like '%?%' ", User.class);
        }
    }
}
